#include <stdio.h>

int main() {
    int D;
    scanf("%d", &D);

    int a = (D + 2) % 7;
    
    if (a == 0) {
        a = 7;
    }

    printf("%d\n", a);
    
    return 0;
}
